package com.lvliucun.validate.exception;


import java.text.MessageFormat;

/**
 * @Description 参数错误
 * @Author zhuojiajin
 * @Date 2020/8/14
 **/
public class ParamException extends RuntimeException{

    private static final long serialVersionUID = 6958499248468627021L;

    /** 错误码 */
    private Integer errorCode;

    private String errorPath;

    public ParamException(CustomerErrorCodeEnum errorCode, String errorMsg,String errorPath){
        super(MessageFormat.format(errorCode.getDescription(), errorMsg));
        this.errorCode = errorCode.getCode();
        this.errorPath = errorPath;
    }
    public ParamException(Integer errorCode, String errorMsg,String errorPath){
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorPath = errorPath;
    }

    public ParamException(Integer errorCode, String errorMsg, String errorPath,Throwable throwable){
        super(errorMsg,throwable);
        this.errorCode = errorCode;
        this.errorPath = errorPath;
    }
    public ParamException(CustomerErrorCodeEnum errorCode, String errorMsg,String errorPath, Throwable throwable){
        super(errorMsg,throwable);
        this.errorCode = errorCode.getCode();
        this.errorPath = errorPath;
    }

    public Integer getErrorCode() {
        return errorCode;
    }
    public String getErrorPath() {
        return errorPath;
    }
}
